function $(id){
    return document.getElementById(id);
}

window.onload = function (){
    initCountry();
}

function initCountry(){
    axios.get("/country/findAll").then(resp =>{
       var info  = resp.data;
       var str = "";
       info.forEach(n => {
          str += `<option value="${n.id}">${n.name}</option>`;
       });
       $("countrySelect").innerHTML = str;
    });

}

function findCity(){
    axios.get("/city/findByCountry",{
        params:{
            countryId:$("countrySelect").value
        }
    }).then(resp =>{
       var info = resp.data;
       var str = "";
       info.forEach(n =>{
           str += `<option value="${n.id}">${n.name}</option>`;
       });
       $("citySelect").innerHTML = str;
    });
}
